-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/mz 180 ledger list edit delete, error handling, category config #67
Conversation
@@ -221,7 +221,7 @@ fun SusuLimitDatePickerBottomSheet( | |||
InfiniteColumn( | |||
modifier = Modifier.width(100.dp), | |||
items = yearList, | |||
initialItem = stringResource(R.string.word_year_format, criteriaYear), | |||
initialItem = stringResource(R.string.word_year_format, selectedYear), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
에러 수정 감사합니다,,
|
||
@Singleton | ||
@Provides | ||
fun provideCategoryConfigDao(db: RoomInMemoryDataBase) = db.categoryConfigDao() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
category 캐싱을 위해 도입했다고 이해하면 될까용?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 맞습니다!
data class CategoryConfigEntity( | ||
@PrimaryKey | ||
val id: Int, | ||
val seq: Int, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seq
가 어떤 데이터인가요? 스웨거랑 정보 정의된거 봐도 감이 안 와서요 ㅎㅎ; 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sequence 순서 같아요!
직렬화/역직렬화 과정에서 순서가 바뀔 수도 있어 내려주는거같습니다~!
fun navigate(tab: MainNavigationTab) { | ||
val navOptions = navOptions { | ||
popUpTo(navController.graph.findStartDestination().id) { | ||
popUpTo(SentRoute.route) { | ||
saveState = true | ||
} | ||
launchSingleTop = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요기 받아요가 초기 루트여서 이렇게 설정하신걸까요? 혹은 개발 과정에서 받아요로 잠시 바꾸셨던걸까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 초기 루트여서 저렇게했어요!
navController.graph.findStartDestination().id로 하게되면 saveState가 제대로 안먹더라구요 ... !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compose navigation option들 많이 헷갈리네여,, 시간 나면 한번 파봐야겠어요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
포스팅해주시면 감사히 읽겠습니다 ... ㅎㅎ
일단 임시로 틀어막아놨네요 ㅜㅜ
DialogToken( | ||
title = context.getString(com.susu.feature.received.R.string.ledger_detail_screen_dialog_title), | ||
text = context.getString(com.susu.feature.received.R.string.ledger_detail_screen_dialog_description), | ||
confirmText = context.getString(R.string.word_delete), | ||
dismissText = context.getString(R.string.word_cancel), | ||
onConfirmRequest = sideEffect.onConfirmRequest, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DialogToken
이 String
대신 @StringRes id
를 받도록 할까요? Dialog 쓰는 곳에서 보기 안좋은거 같아서유
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String이 더 범용적이어서 일단 조금 더 사용해보고 바꾸는거 어떠세요?
만약 DiglogToken의 text를 @StringRes
타입으로 바꾼다면 ...
Throwable의 message(String Type)를 DialogToken의 text에 대입할 수 없을거같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throwable msg를 생각 못했네요 유지합시다!
private var ledger = Ledger() | ||
|
||
fun initData(backStackEntryLedgerUri: String?) { | ||
if (backStackEntryLedgerUri == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backStackEntryLedgerUri == null
이 어떤 상황을 나타내는 건가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 ... 이거 주석을 넣는다는걸 깜빡했네요
LedgerDetail
의 진입 경로는 2가지가 있어요.
- ReceivedScreen -> LedgerDetail (
받아요 화면
에서장부 상세 화면
으로 이동한 경우) - LedgerEdit -> LedgerDetail (
장부 편집 화면
에서장부 상세 화면
으로 이동한 경우)
1번 케이스(받아요 -> 장부 상세
)의 경우 route
의 argument
로 Ledger
를 받고
2번 케이스(장부 편집 -> 장부 상세
)의 경우 navBackStackEntry
로 부터 Ledger
를 받습니다.
backStackEntryLedgerUri == null
이 의미하는 건 navBackStackEntry
로부터 Ledger를 받지 못한 상황입니다.
이 상황은 받아요 -> 장부 상세
로 이동했다는걸 의미합니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아아 이해했습니다~! 명쾌하고 상세한 설명 감사해요!
data class LedgerEditState( | ||
val name: String = "", | ||
val selectedCategoryId: Int = 0, | ||
val customCategory: String = "", | ||
val startYear: Int = 0, | ||
val startMonth: Int = 0, | ||
val startDay: Int = 0, | ||
val endYear: Int = 0, | ||
val endMonth: Int = 0, | ||
val endDay: Int = 0, | ||
val categoryConfigList: PersistentList<Category> = persistentListOf(Category()), | ||
val showCustomCategoryButton: Boolean = false, | ||
val isCustomCategoryChipSaved: Boolean = false, | ||
val showStartDateBottomSheet: Boolean = false, | ||
val showEndDateBottomSheet: Boolean = false, | ||
) : UiState { | ||
val isSelectedCustomCategory = selectedCategoryId == categoryConfigList.last().id | ||
val saveButtonEnabled = when { | ||
name.isEmpty() -> false | ||
isSelectedCustomCategory && (customCategory.isEmpty() || isCustomCategoryChipSaved.not()) -> false | ||
else -> true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정보도 많고 UI 요소도 많다보니 State가 어마어마하네요 ㅋㅋㅋㅋ
💡 Issue
🌱 Key changes
✅ To Reviewers
LedgerDetailViewModel
의deleteLedger()
에서 에러 핸들링하는 부분 봐주세요.지금부터 하는 작업에는 에러 핸들링 부탁드립니다~! @yangsooplus @syb8200
장부 편집, 삭제 시 -> api를 재호출하지 않고 편집/삭제된 장부를 로컬에서 업데이트 하는 로직으로 구현했습니다.
에러 핸들링의 경우, 공통으로 해야하는 작업이다보니 ASAP 라벨 추가했습니다.
@yangsooplus 님이 짜주신 SusuLimitDatePicker에 사소한 버그가 있어 수정했습니다.
fix: SusuDatePickerBottomSheet 무조건 기준 날짜로 보이는 현상 수정
Mvi 단점이 모든 상태와 사이드 이펙트를 관리해야해서 코드가 많아지는거같아요.
최대한 깔끔하게 짜보려고 했는데 많이 부족합니다.
피드백 환영합니다.
📸 스크린샷
무한 스크롤
default.mp4
장부 편집
default.mp4
장부 삭제
default.mp4
장부 삭제 에러 핸들링
default.mp4